package cn.edu.scau.cmi.wuzhenxin.client;

import cn.edu.scau.cmi.wuzhenxin.domain.Insure;
import cn.edu.scau.cmi.wuzhenxin.factory.CarInsureFactory;
import cn.edu.scau.cmi.wuzhenxin.factory.DriverInsureFactory;
import cn.edu.scau.cmi.wuzhenxin.factory.InsureFactory;
import cn.edu.scau.cmi.wuzhenxin.factory.MulInsureFactory;
import cn.edu.scau.cmi.wuzhenxin.factory.PeopleInsureFactory;
import cn.edu.scau.cmi.wuzhenxin.simpleFactory.SimpleFactory;
import javafx.fxml.FXML;

import javafx.scene.control.Button;

import javafx.scene.control.TextArea;

import javafx.scene.control.ChoiceBox;

public class MyController2 {
	@FXML
	private Button showbt;
	@FXML	
	private ChoiceBox name;
	@FXML
	private TextArea detilText;

	private InsureFactory factory = null;
	
	public void eventButton() {
		String value = (String)name.getValue();
		switch (value) {
		case "驾驶员身体受伤":
			factory = new DriverInsureFactory();
			break;
		case "汽车损坏":
			factory = new CarInsureFactory();
			break;
		case "人员伤亡":
			factory = new PeopleInsureFactory();
			break;
		case "多种事故":
			factory = new MulInsureFactory();
			break;
		default:
			break;
		}
		detilText.setText(factory.getInstance().showMessage());
	}
}